package com.bba.manager.order.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bba.manager.common.model.order.Purchase;
import com.bba.manager.common.model.order.VO.purchaseQuery;
import com.bba.manager.common.util.ResponseVO;
import com.bba.manager.order.service.impl.PurchaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 采购订单表 前端控制器
 * </p>
 *
 * @author zzy
 * @since 2025-08-12
 */
@RestController
@RequestMapping("/purchase")
public class PurchaseController {
    @Autowired
    private PurchaseServiceImpl purchaseService;

    @GetMapping("/listall")
    public ResponseVO listall(){
        return ResponseVO.success(purchaseService.list());
    }
    @GetMapping("/check")
    public ResponseVO check(@RequestParam Long purchaseId,@RequestParam boolean flag){
        purchaseService.check(purchaseId,flag);
        return ResponseVO.success();

    }
    @GetMapping("/getPurchase")
    public ResponseVO getPurchase(purchaseQuery one){
        IPage<Purchase> page = purchaseService.pageALl(one);
        return ResponseVO.success(page);
    }

}
